package com.example.springioc.demo4;

import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024-11-19
 * Time: 12:10
 */
@Controller
public class D4UserController {
    //@Resource
    @Autowired
    @Qualifier("lisi")//必须要引入依赖才行，可以不用写name=
    //@Resource(name = "lisi")//必须要加=号
    private D4UserInfo info;//Spring匹配相应的bean对象的规则是，先从名称找，再从类型中找
    public void sayHi(){
        System.out.println(info);
        System.out.println("he,D4UserController");
    }
}
